{template 'public/header'}

{template 'public/comhead'}

<link rel="stylesheet" type="text/css" href="../addons/yzzc_sun/template/public/ygcsslist.css">
<ul class="nav nav-tabs">
    <span class="ygxian"></span>
    <div class="ygdangq">当前位置:</div>
    <li  {if $type=='all'} class="active" {/if}><a href="{php echo $this->createWebUrl('storelist',array('type'=>all));}">全部车辆</a></li>
</ul>
<br>
<div class="row ygrow">
    <div class="col-lg-12">
        <form action="" method="get" class="col-md-4">
            <input type="hidden" name="c" value="site" />
            <input type="hidden" name="a" value="entry" />
            <input type="hidden" name="m" value="yzzc_sun" />
            <input type="hidden" name="do" value="goods_apply" />
            <div class="input-group">
                <input type="text" name="keywords" class="form-control" placeholder="请输入车辆号">
                <span class="input-group-btn">
                    <input type="submit" class="btn btn-default" name="submit" value="查找"/>
                </span>
            </div>
            <input type="hidden" name="token" value="{$_W['token']}"/>
        </form>

        <div class="col-md-4">
            <input type="hidden" name="token" value="{$_W['token']}"/>
        </div>
    </div><!-- /.col-lg-6 -->
</div>

<!--<div class="row ygrow">-->
<!--    <div class='col-lg-12'>-->
<!--        <a  href="{php echo $this->createWebUrl('storelist',array('op'=>add));}"><button class="btn btn-sm store-blue">添加车辆</button></a>-->
<!--    </div>-->
<!--</div>-->
<div class="main ">

    <div class="panel panel-default">
        <div class="panel-heading">
            门店列表
        </div>
        <div class="panel-body" style="padding: 0px 15px;">
            <div class="row" id="accordion">
                <table class="yg5_tabel col-md-12">
                    <tr class="yg5_tr1">
                        <td class="col-md-1 store_td1">车辆名称</td>
                        <td class="col-md-1">所属商家/车主</td>
                        <td class="col-md-1">商家类型</td>
                        <td class="col-md-2">颜色/车身结构/排量/变速箱/核载人数</td>
<!--                        <td class="col-md-1">租金</td>-->
                        <td  class="col-md-1">备注</td>
                        <td class="col-md-1">申请状态</td>
                        <td class="col-md-2">创建时间</td>
                        <td class="col-md-1">操作</td>
                    </tr>

                    {loop $info $key $item}
                    <tbody>
                    <tr class="yg5_tr2" >
                        <td>{$item['name']}</td>
                        <td>{$item['store_name']}</td>
                        <td>
                            {if $item['source_type']==2}
                            <span class="label store-yellow btn btn-sm">商户入驻</span>
                            {elseif $item['source_type']==3}
                            <span class="label store-green btn btn-sm">个体商家</span>
                            {/if}
                        </td>
                        <td>
                            {loop $item['spec'] $index $value}
                            <p>{$value['carnum']} /{$value['carcolor']} / {if $item['structure'] == 1}两厢
                                {elseif $item['structure'] == 2}三厢{/if} / {if $item['grarbox'] == 1}手动挡
                                {elseif $item['grarbox'] == 2}自动挡{/if} / {$value['displacement']} / {$item['num']}人</p>
                            {/loop}
                        </td>
<!--                        <td>{$item['money']}</td>-->
                        <td>{$item['audit_remark']}</td>
                        <td>
                            {if $item['audit_status']==0}
                            <span class="label store-yellow btn btn-sm">审核中</span>
                            {elseif $item['audit_status']==1}
                            <span class="label store-green btn btn-sm">审核通过</span>
                            {elseif $item['audit_status']==2}
                            <span class="label store-red btn btn-sm">审核失败</span>
                            {/if}
                        </td>
                        <td>{$item['createtime']}</td>
                        <td>
                            {if $item['audit_status']==0}
                            <a class="btn btn-xs store-green" href="/web/index.php?c=site&a=entry&do=goods_apply&op=change&id={$item['id']}&status=1&module_name=yzzc_sun&version_id=1">
                                通过
                            </a>
                            <a href="javascript:void(0);" class="btn btn-xs store-red" data-toggle="modal" data-target="#myModal{$item['id']}">
                                驳回
                            </a>
                            {elseif $item['audit_status'] == 1 && $item['status'] == 3}
                            <a class="btn btn-xs store-green" href="/web/index.php?c=site&a=entry&do=goods_apply&op=shelves&id={$item['id']}&status=1&module_name=yzzc_sun&version_id=1">
                                上架
                            </a>
                            {/if}
<!--                            <a href="/web/index.php?c=site&a=entry&do=goodsinfo&op=shelves&id={$item['id']}&status=1&module_name=yzzc_sun&version_id=1" class="storespan btn btn-xs">-->
<!--                                <span class="fa fa-pencil"></span>-->
<!--                                <span class="bianji">编辑-->
<!--                                    <span class="arrowdown"></span>-->
<!--                                 </span>-->
<!--                            </a>-->
                            <a href="javascript:;" class="storespan btn btn-xs" onclick="del({$item['id']})">
                                <span class="fa fa-trash-o"></span><span class="bianji">删除<span class="arrowdown"></span></span>
                            </a>
                        </td>
                    </tr>
                    </tbody>
                    <div class="modal fade" id="myModal{$item['id']}" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
                        <div class="modal-dialog" role="document">
                            <div class="modal-content">
                                <div class="modal-header">
                                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                                    <h4 class="modal-title" id="myModalLabel" style="font-size: 20px;">拒绝备注</h4>
                                </div>
                                <form action="" method="get" >
                                    <input type="hidden" name="c" value="site" />
                                    <input type="hidden" name="a" value="entry" />
                                    <input type="hidden" name="m" value="yzzc_sun" />
                                    <input type="hidden" name="do" value="storecar" />
                                    <input type="hidden" name="id" value="{$item['id']}" />
                                    <input type="hidden" name="op" value="change" />
                                    <input type="hidden" name="status" value="2" />
                                    <div class="modal-body" style="font-size: 20px">
                                        <input type="text" name="audit_remark" placeholder="拒绝理由" class="form-control"/>
                                    </div>
                                    <div class="modal-footer">
                                        <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                                        <input type="submit" class="btn btn-info" name="submit" value="确定"/>
                                    </div>
                                    <input type="hidden" name="token" value="{$_W['token']}"/>
                                </form>
                            </div>
                        </div>
                    </div>
                    {/loop}
                    {if empty($item)}
                    <tr class="yg5_tr2">
                        <td colspan="8">
                            暂无地址信息
                        </td>
                    </tr>
                    {/if}
                </table>
            </div>
        </div>

    </div>
    </form>
</div>
<script type="text/javascript">
    $(function(){
        $("#frame-7").show();
        $("#yframe-7").addClass("wyactive");
    })
    function del(id) {
        var ret = confirm("删除前请确认该门店所有车辆均已下架，您确定删除吗？")
        if (ret==true){
            $.ajax({
                type:"POST",
                url:"/web/index.php?c=site&a=entry&op=delete&do=storecar&op=delete&module_name=yzzc_sun&version_id=1",
                dataType:"JSON",
                data:{id:id},
                success:function(res){
                    location.reload();
                    // if(res.status == 1) {
                    //     layer.msg(res.message, {icon: 1});
                    //     location.href ="{php echo $this->createWebUrl('renting')}";
                    // }else{
                    //     layer.msg(res.message, {icon: 6});
                    //     location.href =res.url;
                    // }
                }
            })
        }
    }
</script>